<form class="layui-form seller-form" action="" method="post">
    <div class="layui-form-item">
        <div class="layui-inline" style="padding-left: 5px;">
            <input type="text" name="user_name" lay-verify="title" placeholder="Input User Name" autocomplete="off"
                   class="layui-input" style="width: 200px;">
        </div>
        <div class="layui-inline" style="">
            <select name="sort_type" lay-verify="" >
                <option value="1">降序</option>
                <option value="2">升序</option>
            </select>
        </div>
        <div class="layui-inline">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-sm" lay-submit lay-filter="*"><i class="iconfont icon-chaxun"></i>Search</button>
            </div>
        </div>
    </div>
</form>
<div class="table-body">
    <table id="balanceTable" lay-filter="balanceTable"></table>
</div>
<script>
    layui.use(['form', 'table'], function () {
        var form = layui.form,
            table = layui.table; //表格

        table.render({
            elem: '#balanceTable',
            height: 'full-99',
            cellMinWidth: '80',
            totalRow: true,
            method: 'post',
            url: "{:url('refundData')}",
            id: 'balanceTable',
            toolbar: '#toolbar', //开启头部工具栏，并为其绑定左侧模板
            defaultToolbar: ['exports'],
            cols: [[
                { type: 'numbers'},
                { field: 'username',  align: 'left', title: 'UserName',width: 240,
                    templet:function (d) {
                        const username = d.username;
                        const user_id  = d.id;
                        var html = '<a href="{:url(\'refundDetail\')}?user_id=' + user_id + '" style="color: #428bca;font-weight:bold;">' + username + '</a>';
                        return html;
                    }},
                {field: 'sum_amount', title: 'SumAmount($)', align:"right",
                    style:'color:#FF5722;font-weight:bold' , width:160,totalRow: true
                },
                {field: "{$time_1}", title: "{$time_1}", align:"right",
                    style:'font-weight:bold',totalRow: true
                },
                {field: "{$time_2}", title: "{$time_2}", align:"right",
                    style:'font-weight:bold',totalRow: true
                },
                {field: "{$time_3}", title: "{$time_3}", align:"right",
                    style:'font-weight:bold',totalRow: true
                },
                {field: "{$time_4}", title: "{$time_4}", align:"right",
                    style:'font-weight:bold',totalRow: true
                },
                {field: "{$time_5}", title: "{$time_5}", align:"right",
                    style:'font-weight:bold',totalRow: true
                },
                {field: "{$time_6}", title: "{$time_6}", align:"right",
                    style:'font-weight:bold' ,totalRow: true
                },
                {field: "{$time_7}", title: "{$time_7}", align:"right",
                    style:'font-weight:bold',totalRow: true
                }
            ]],
            page: true,
            limit: 200,
            limits: [200],
        });
        form.on('submit(*)', function (data) {
            layui.table.reload('balanceTable', {
                where: data.field
                , page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
    });
</script>